// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import VueResource from 'vue-resource'
import App from './App'
import router from './router'
import store from '@/store/index'



Vue.config.productionTip = false
//true 用于取消日誌和警告
Vue.config.silent = false
Vue.use(VueResource)

new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App }
})












//初始化 rem
function getfont() {
  var html1 = document.documentElement;
  var screen = html1.clientWidth;
  //html1.style.fontSize = 0.02666666666666667 * screen + 'px';
  html1.style.fontSize = 0.0625 * screen + 'px';
};
getfont();
window.onresize = function() {
  getfont();
};


//json转urlparams
Vue.http.options.emulateJSON = true;
//请求拦截器
Vue.http.interceptors.push((request, next) => {
  //在响应之后传给then之前对response进行修改和逻辑判断。对于token时候已过期的判断，就添加在此处，页面中任何一次http请求都会先调用此处方法
  next((response) => {
    console.info(response);
    if(response.body.code==1){

    }else{
      response.ok=false;
    }
    return response;
  });
});



